//
//  QYBookDetailCommentTableViewCell.m
//  QingYue
//
//  Created by 崔明燃 on 2017/4/2.
//  Copyright © 2017年 com.lanou.product_A. All rights reserved.
//

#import "QYBookDetailCommentTableViewCell.h"
#import "QYMoreCommentsModel.h"

@implementation QYBookDetailCommentTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    _headerView.layer.masksToBounds = YES;
    _headerView.layer.cornerRadius = 25;

    [_clickBtn setImage:[UIImage imageNamed:@"jiangou"] forState:UIControlStateNormal];
    [_clickBtn setImage:[UIImage imageNamed:@"tuijiancc"] forState:UIControlStateSelected];
    
    [_clickBtn setTitleColor:RGB(32, 203, 37, 1) forState:UIControlStateNormal];
    

}

- (void)setModel:(QYMoreCommentsModel *)model {
    _model = model;
    
    [_headerView sd_setImageWithURL:[NSURL URLWithString:_model.UserHead] placeholderImage:[UIImage imageNamed:@"默认用户头像"]];
    _nameLabel.text = _model.UserName;
    _timeLabel.text = _model.CommentTime;
    _infoLabel.text = _model.CommentCont;
    [_clickBtn setTitle:[NSString stringWithFormat:@" %@",_model.Count] forState:UIControlStateNormal];
    
    _clickBtn.selected = _model.IsFabulous.integerValue == 0 ? NO:YES;
    
}

- (IBAction)clickBtnAction:(UIButton *)sender {
    if (sender.selected) {
        sender.userInteractionEnabled = NO;
    } else {
        _thumbUpBlock(_model.c_id);
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
